#include <iostream>
using namespace std;

class X {}; //空类的大小是1，因为空类也会被实例化，象征性的用一个字节填充，这样它就能在内存中拥有地址

class A{
public:
    A();
    ~A();
};

class B{
public:
    int i;
    int k;
    //double j;
    B() {}
    virtual int fun () {cout<<"fun"<<endl;return 0;}
    void * fun1 () {}
    ~B() {}
};

struct C {
    //int a;//使对齐方式变为4
    double a;//使对齐方式变为8
    char b;
    char c;
    char d;
    char e;
    char f;
};

int main ()
{
    cout << sizeof (A) << endl;
    cout << sizeof (B) << endl;
    cout << sizeof (C) << endl;
    struct C cc;
    B bb;
    bb.fun();
    cout << sizeof (bb) << endl;
    B* bbb = new B();
    bbb = NULL;
    bbb->fun();
    cout << sizeof (bbb) << endl;

    return 0;
}

